# core/models.py 或 home/models.py
from django.db import models


class Banner(models.Model):
    title = models.CharField(max_length=100, blank=True)
    image_url = models.URLField()
    link_url = models.URLField(blank=True, help_text="点击跳转链接，可为空")
    order = models.PositiveIntegerField(default=0, help_text="越小越靠前")
    is_active = models.BooleanField(default=True)
    start_time = models.DateTimeField(null=True, blank=True)
    end_time = models.DateTimeField(null=True, blank=True)
    created_at = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return self.title or f"Banner {self.id}"
